package com.wsd.jing.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wsd.jing.validator.group.InsertGroup;
import com.wsd.jing.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;

/**
 * All rights Reserved, Designed By www.tom.com
 *
 * @author tom
 * @version 1.0.0
 * @projectName: jing
 * @packageName: com.wsd.jing.entity
 * @className: RolePermission
 * @description: RolePermission
 * @createDate 2023-11-10 11:01
 * @copyright 2023-11-10 11:01 www.tom.com Inc. All rights reserved.
 */
@Getter
@Setter
@ToString
@TableName("j_role_permission")
@ApiModel(value = "RolePermission对象", description = "角色权限关联表")
public class RolePermission implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "角色数据权限ID不能为空", groups = UpdateGroup.class)
    @Null(message = "角色数据权限ID为空", groups = InsertGroup.class)
    @ApiModelProperty("角色数据权限ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotNull(message = "数据权限类型不能为空")
    @ApiModelProperty("数据权限类型=》0:所有，1:本部门及以下，2:本部门，3:本人，4:自定义")
    @TableField("type")
    private Integer type;

    @Length(message = "数据权限标识长度不能超过2000个字符")
    @ApiModelProperty("数据权限标识")
    @TableField("permission")
    private String permission;

    @NotNull(message = "角色ID不能为空")
    @ApiModelProperty("角色ID")
    @TableField("role_id")
    private String roleId;

}
